<?php
/**
 * 管理员管理页
 *
 */
class PropertyFeeAction extends BaseAction{
    public function index(){
		$model = D('PropertyFee');
		$year = $_REQUEST["year"];
		$month = $_REQUEST["month"];
		$where = "1=1";
		if(!empty($year)) {
			$where .= " and year ='{$year}'";
		}
		if(!empty($month)) {
			$where .= " and month ='{$month}'";
		}
		//dump($where);
		$data_list = $model->where($where)->order('create_time desc')->select();
		$this->assign('data_list',$data_list);
		$this->display();
    }
	public function add(){
		$this->display();
	}
	
	/**
	 * 新增
	 */
	public function save(){
		$model = D('PropertyFee');
		if($model->create()) {
			$model->create_time = date();
			$model->is_payment = "0";
			$result =   $model->add();
			if($result) {
				$this->success('操作成功！');
			}else{
				$this->error('写入错误！');
			}
		}else{
			$this->error($model->getError());
		}
	}
	
	public function delete($id=0) {
		$model = M ( 'PropertyFee' );
		$result = $model->delete ( $id );
		if ($result) {
			$this->success ( '删除成功！' );
		} else {
			$this->error ( '删除错误！' );
		}
	}
	
	public function edit($id=0){
		$model = M('PropertyFee');
		$this->vo = $model->find($id);
		$this->display();
	}
	
	/**
	 * 修改
	 */
	public function update(){
		$model   =   D('PropertyFee');
		if($model->create()) {
			$result =   $model->save();
			if($result) {
				$this->success('操作成功！');
			}else{
				$this->error('写入错误！');
			}
		}else{
			$this->error($Form->getError());
		}
	}

}